package com.banana.manager.forest.controller.info;

import com.banana.manager.forest.entity.info.MiceBean;
import com.banana.manager.forest.service.impl.info.MiceServiceImpl;
import com.github.pagehelper.PageInfo;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/mice")
public class MiceController {

    @Resource
    private MiceServiceImpl miceService;

    @PostMapping("/addMice")
    public MiceBean addMice(@RequestBody MiceBean miceBean){
        return miceService.addNewMice(miceBean);
    }

    @GetMapping("/showMice")
    public MiceBean getOneMice(Integer miceId){
        return miceService.findOneById(miceId);
    }

    @GetMapping("/displayMice")
    public PageInfo<MiceBean> getAllMice(Integer page, String miceName){
        return miceService.findBlurByPage(page,miceName);
    }
}
